package com.baizan.daka.base

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout

abstract class BaseLayoutView : ConstraintLayout {

    var mContentView: View? = null

    constructor(context: Context) : super(context) {
        init()
    }

    constructor(context: Context, attrs: AttributeSet) : super(context, attrs)

    constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(
        context,
        attrs,
        defStyleAttr

    )


    override final fun onFinishInflate() {
        super.onFinishInflate()
        init()
    }

    fun init() {
        mContentView = LayoutInflater.from(context).inflate(initLayout(), this)
        initView()
        initData()
    }


    abstract fun initLayout(): Int


    open fun initData() {
    }

    open fun initView() {}

}